package com.erp.warehouse.clouderp_warehouse.service.impl.inbound;

import com.erp.warehouse.clouderp_warehouse.mapper.inbound.InboundOrderItemMapper;
import com.erp.warehouse.clouderp_warehouse.pojo.inbound.InboundOrderItem;
import com.erp.warehouse.clouderp_warehouse.service.inbound.InboundOrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author 86188
* @description 针对表【inbound_order_item(物品入库，可以按照批次依次入库)】的数据库操作Service实现
* @createDate 2025-10-31 10:30:28
*/
@Service
@Transactional
public class InboundOrderItemServiceImpl implements InboundOrderItemService {
    @Autowired
    InboundOrderItemMapper mapper;

    @Override
    public boolean addInboundOrderItemList(List<InboundOrderItem> inboundOrderItemList) {
        return mapper.insertInboundOrderItemList(inboundOrderItemList) == inboundOrderItemList.size();
    }

    @Override
    public boolean deleteInboundOrderItemList(List<String> ids) {
        if(ids == null) throw new RuntimeException("删除内容不能为空！");
        return mapper.deleteInboundOrderItemList(ids) == ids.size();
    }

    @Override
    public boolean modifyInboundOrderItem(InboundOrderItem inboundOrderItem) {
        return mapper.updateInboundOrderItem(inboundOrderItem) == 1;
    }

    @Override
    public List<InboundOrderItem> getInboundOrderItemList(String inboundCode) {
        return mapper.selectInboundOrderItemList(inboundCode);
    }
}




